﻿using System;
using System.ComponentModel;
using System.Reflection;

namespace APP.HELPER.Utils
{
    public static class Enumerations
    {
        public static string GetEnumDescription(Enum value)
        {
            FieldInfo field = value.GetType().GetField(value.ToString());
            DescriptionAttribute[] array = (DescriptionAttribute[])field.GetCustomAttributes(typeof(DescriptionAttribute), false);
            string result;
            if (array != null && array.Length > 0)
            {
                result = array[0].Description;
            }
            else
            {
                result = value.ToString();
            }
            return result;
        }
    }
}
